<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
    "http://www.w3.org/TR/html4/loose.dtd">
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<%@taglib prefix="f" uri="http://java.sun.com/jsf/core"%>
<%@taglib prefix="h" uri="http://java.sun.com/jsf/html"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ include file="/WEB-INF/jspf/jsDefault.jspf" %>
<f:view>
    <html>
        <head>
            <%@ include file="/WEB-INF/jspf/header.jspf" %>
        </head>
        <body>
            <%@ include file="/WEB-INF/jspf/controlloStudente.jspf" %>
            <div id="main">
                <header>
                    <div id="logo">
                        <%@ include file="/WEB-INF/jspf/logoContent.jspf" %>
                    </div>
                    <nav id="barraMenu">
                        <div id="menu_container">
                            <ul class="sf-menu" id="nav">
                                <h:form>
                                    <%@ include file="/WEB-INF/jspf/menu/studente.jspf" %>
                                </h:form>
                            </ul>
                        </div>
                    </nav>
                </header>
                <div id="site_content">
                    <div id="sidebar_container">
                        <%@ include file="/WEB-INF/jspf/loggedForm.jspf" %>
                    </div>
                    <div class="content">
                        <div id="accordion">
                            <h3>
                                Richiedi un appuntamento
                            </h3>
                            <div>
                                <h:form prependId="false">
                                    <div class="ui-accordion-content ui-widget-content ui-corner-bottom" style="display:compact">
                                        <h:outputText value="#{ServiziBean.message}" />
                                        <%--<h:message for="termine"/>--%>
                                        <h:outputText value="#{ServiziBean.message2}" />
                                        <h:outputText value="#{ServiziBean.message3}" />
                                        <h:outputText value="#{ServiziBean.message4}" />
                                        <table>
                                            <tr>
                                                <td>La tua matricola</td>
                                                <td>
                                                    <h:selectOneMenu value="#{ServiziBean.studenteId}">
                                                        <f:selectItem id="id" itemValue="#{Login.id}" itemLabel="#{Login.id}"/>
                                                    </h:selectOneMenu>
                                                </td>
                                            </tr>
                                            <tr>
                                                <td>Seleziona il servizio:</td>
                                                <td>
                                                    <h:selectOneMenu id="scelta" value="#{ServiziBean.tipoId}" >
                                                        <f:selectItems value="#{ServiziBean.listaTipo}"/>
                                                    </h:selectOneMenu>
                                                </td>
                                            </tr>
                                            <tr>
                                                <td>Seleziona il tutor:</td>
                                                <td>
                                                    <h:selectOneMenu id="tutor" value="#{ServiziBean.tutorId}" >
                                                        <f:selectItems value="#{ServiziBean.listaTutor}"/>
                                                    </h:selectOneMenu>
                                                </td>
                                            </tr>
                                        </table>
                                    </div>
                                    <div class="ui-accordion-content ui-widget-content ui-corner-bottom" style="display:compact">
                                        <table> 
                                            <tr>
                                                <td>
                                                    Seleziona data
                                                </td>
                                                <td>
                                                    <div id="datePicker">
                                                    </div>
                                                    <h:inputHidden id="dataGiorno" value="#{ServiziBean.giorno}"/>
                                                    <h:inputHidden id="dataMese" value="#{ServiziBean.mese}"/>
                                                    <h:inputHidden id="dataAnno" value="#{ServiziBean.anno}" />
                                                </td>
                                            </tr>
                                            <tr>
                                                <td>
                                                    Ora
                                                </td>
                                                <td>
                                                    <h:selectOneMenu id="ora" value="#{ServiziBean.ora}" >
                                                        <f:selectItems value="#{ServiziBean.listaOre}"/>
                                                    </h:selectOneMenu>
                                                </td>
                                            </tr>
                                            <tr>
                                                <td></td>
                                                <td>
                                                    <h:commandButton value="Richiedi" action="#{ServiziBean.richiedi}" styleClass="ui-button ui-widget ui-state-default">
                                                    </h:commandButton>
                                                </td>
                                            </tr>
                                        </table>
                                    </div>
                                </h:form>

                            </div>
                            <h3>
                                Iscriviti ad un Corso
                            </h3>
                            <div>
                                <h:form>

                                    <c:set var="presenteCorso" value="#{ServiziBean.presentiCorsi}"/>
                                    <c:choose>
                                        <c:when test="${presenteCorso}">
                                            <table>
                                                <tr>
                                                    <td>Seleziona Corso</td>
                                                    <td>
                                                        <h:selectOneMenu id="corso" value="#{ServiziBean.corsoId}" >
                                                            <f:selectItems value="#{ServiziBean.listaCorsi}"/>
                                                        </h:selectOneMenu>
                                                    </td>
                                                </tr>
                                                <tr>
                                                    <td></td>
                                                    <td align="right">
                                                        <h:commandButton value="Iscriviti" action="#{ServiziBean.iscriviti}" styleClass="ui-button ui-widget ui-state-default"/>
                                                    </td>
                                                </tr>
                                                <tr>
                                                </tr>
                                            </table>
                                        </c:when>
                                        <c:otherwise>
                                            <h2> Non sono presenti corsi ai quali iscriversi.</h2>
                                        </c:otherwise>
                                    </c:choose> 
                                </h:form>
                            </div>
                        </div>
                    </div>
                </div>
                <footer>
                    <p>Copyright &copy; FF-RL 2014</p>
                </footer>
            </div>
            <p>&nbsp;</p>
            <%@ include file="/WEB-INF/jspf/animazioneAccordion.jspf" %>
            <%@ include file="/WEB-INF/jspf/menu/scriptAnimazioneMenu.jspf" %>
            <script>
                jQuery('#datePicker').datepicker({
                    onSelect: function(dateText, inst) {
                        var date = jQuery('#datePicker').datepicker('getDate');
                        jQuery('#dataGiorno').attr("value", date.getDate());
                        jQuery('#dataMese').attr("value", date.getMonth() + 1);
                        jQuery('#dataAnno').attr("value", date.getFullYear());
                    }
                });
            </script>
            <%@ include file="/WEB-INF/jspf/about/contatti.jspf" %>
        </body>
    </html>
</f:view>
